<?php

namespace App\Admin\Forms\User;

use App\Wen\Utils\SafeUtils;
use Dcat\Admin\Contracts\LazyRenderable;
use Dcat\Admin\Traits\LazyWidget;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Facades\Cache;

class UserRealNameForm extends Form implements LazyRenderable
{
    use LazyWidget;

    /**
     * 处理表单请求.
     *
     * @param array $input
     *
     * @return mixed
     */
    public function handle(array $input)
    {

        return $this->response()
            ->success('无需操作.')
            ->refresh();
    }

    /**
     * 构建表单.
     */
    public function form()
    {
        $user_id = $this->payload["id"];
        $this->html(function (){
            return '<div style="background-color: powderblue;color: #414750;padding: 10px;border-radius: 5px;">根据中华人民共和国法律，对公民三要素进行加密存储，若需要密文换取明文，请先复制密文信息，然后私聊群主</div>';
        }, '');
        $this->hidden('id')->value($user_id);
        // 需要先进行base64_decode
        $this->textarea('real_info', '实名密文')->default(get_user_meta($user_id, 'real_info_encrypted', 's'))->disable();
    }
}
